<?php
//
class Codes  extends BaseModel
{
	protected $res;
	protected $redis_key="user_";
	public function getSource()
    {
        return "f_verification_codes";
    }
	protected function initialize()
	{
		 parent::initialize();
	}

    /**
     * @func 更新/插入数据
     * @param $data要更新或者要插入的数据
     * @return 插入成功的结果
     */
	public function save_codes($data){
        $result = $this->save($data);
        return $result;
    }


    public function find_by_phone($phone){
        $code_info = $this->findFirstByRecipient($phone);
        if(!$code_info){
            return false;
        }else{
            return $code_info->toarray();
        }
    }




}
